<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/hn-jg/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="/hn-jg/src/css/public.css">
</head>

<body>
    <div style="padding: 10px;">
        <form class="layui-form" action="" lay-filter="layui-form-Table">
            <ul class="layui-form layui-form-pane formUl" style="margin: 15px;">
				<li class="layui-form-item">
					<label class="layui-form-label">字段1</label>
					<div class="layui-input-block">
						<input type="text" name="apppath" lay-verify="required" autocomplete="off" placeholder="请输入字段1" class="layui-input">
					</div>
				</li>
				<li class="layui-form-item">
					<label class="layui-form-label">字段2</label>
					<div class="layui-input-block">
						<input type="text" name="appversion" lay-verify="required" autocomplete="off" placeholder="请输入字段2" class="layui-input">
					</div>
				</li>
			</ul>

            <div style="text-align: center;">
				<input type="hidden" name="id" value="0">
				<button class="layui-btn" lay-submit lay-filter="YjbtnSave" id="YjbtnSave" type="button">提交</button>
			</div>
        </form>
    </div>
    <script src="/hn-jg/layui/layui.js"></script>
    <script>
        layui.config({
			base: '/hn-jg/src/'
		}).use('index', function () {
			var admin = layui.admin
				, main = layui.main
				, form = layui.form
				, table = parent.layui.table;

            //加载表单内容
            admin.req({
                url: 'system/appversions/Edit'
                , type: 'get'
                , data: { id: main.getPageParams('id') }
                , done: function (res) {
					if(res.successful){
					   form.val("layui-form-Table",{
							"id": res.data.id
							,"apppath": res.data.apppath
							,"appversion": res.data.appversion
						});
					}
                }
            });

            //保存
			form.render().on('submit(YjbtnSave)', function (data) {
				admin.req({
					url: 'system/appversions/Update'
					, data: JSON.stringify(data.field)
					, contentType: 'application/json'
					, type: 'put'
					, done: function (res) {
						if (res.successful) {
							main.msg_success(res.msg);
							table.reload('LAY-app-appversions-list');
						}
						else {
							main.msg_error(res.msg);
						}
					}
				});
			});
        });
    </script>
</body>

</html>